<template>
	<view class="padb30">
		<cu-custom bgColor="bg-gradual-blue" isBack="">
			<block slot="content">流程管理系统·订单</block>
		</cu-custom>
	<!-- 	<view class="flrc">
			<view class="wh30-30 flcc bg-red">
				<text class="fa fa-file-text fa-4x"></text>
			</view>
			<view class="flex1">
				<view></view>
			</view>
		</view> -->
		<view class="pad3">
			<view class="cu-form-group">
				<view class="title">单号查询</view>
				<input placeholder="请输入订单编号" name="input" v-model="text"></input>
				<text class='cuIcon-search text-orange' @tap="search()"></text>
			</view>
		</view>
		<view class="mart3">
			<view class="list-style-1">订单列表</view>
		</view>
		<view>
			<view class="bcf round5 shadow1 marlr3 pad2 mart3" v-for="(item,index) in list" :key="index">
				<view class="flrc padtb1 bdbso" :data-id="item.id" @tap="$win.goto('/pages/stream/orderInfo/orderInfo',$event)">
					<view class="flex1">{{item.sn}}</view>
					<view class=" tar padlr3 padtb1 round1 bdso" :style="'background-color: ' + item.status.background + ';color: ' + item.status.color + ';'">
						{{item.status.name}}
					</view>
					<text class="fa fa-angle-right padl3"></text>
				</view>
				<view class="flex-r flex-start c12 padtb3 bdbso">
					<view class="wh20-20 mart3 marr2">
						<image @tap="viewPic($api.getAssetBaseUrl() + item.cover,[$api.getAssetBaseUrl() + item.cover])"  
						:src="$api.getAssetBaseUrl() + item.cover" class="wh20-20" mode="aspectFill"></image>
					</view>
					<view class="flex1 lh15 fs8 tar">
						<view class="flex1 c11 lh2 fs14 fwb">{{item.info}}</view>
						<view>创建：{{$com.str2time(item.createAt)}}</view>
						<view>开工：{{$com.str2time(item.startAt)}}</view>
						<view>完成：{{$com.str2time(item.finishAt)}}</view>
					</view>
				</view>
				<view class="martb2 list-style-2">工序状态</view>
				<view class="bdtda bdbso flex-r flex-wrap flex-start">
					<view v-for='point,index in item.lists' class="padtb1">
						<!-- <view>
							<view class=" tar padlr3 padtb1 round1 bdso" :style="'background-color: ' + point.status.background + ';color: ' + point.status.color + ';'">
								{{point.status.name}}
							</view>
						</view> -->
						<!-- <view class="flex1 flrc">
							<view>[{{point.status.name}}]</view>
							<view class="flex1 padl5">{{point.point.name}}</view>
						</view> -->
						<view class="pad1">
							<view class="round3 tar pad1 round1 bdso fs8 lh2 tac" :style="'background-color: ' + point.delay.background + ';color: ' + point.delay.color + ';'">
								<view class="fwb bdbso bdc13">{{index+1}}.{{point.point.name}}</view>
								<view class="fs6">{{point.delay.name}}</view>
							</view>
						</view>
					</view>
				</view>
				<view class="martb2 list-style-2">订单备注</view>
				<view class="bdtda pad3 bdbso">
					{{item.tips}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import api from '../../../static/js/api.js'
	import com from '../../../static/js/com.js'
	import win from '../../../static/js/win.js'
	import list from '../../../static/js/list.js'
	export default {

		data() {
			return {
				list: [],
				text:''
			}
		},
		methods: {

			search() {
				list.setUrl('/api/streamOrders')
				list.setData({_search:this.text})
				list.reload()
			}
		},
		created() {

			let _this = this
			list.setUrl('/api/streamOrders')
			list.setData({})
			list.setCbFunc((res) => {
				console.log(res)
				this.list = res
			})
			list.reload()
		},
		onShow() {

		},
		onReachBottom() {
			list.getList()
		},
		onPullDownRefresh() {
			list.reload()
		}
	}
</script>

<style>

</style>
